<?php

require_once 'Zend/View/Helper/Abstract.php';

class Core_View_Helper_Navigation_MenuRenderer extends Core_View_Helper_Navigation_Abstract
{
    protected $_attribs = array(
        'indent'            => 4,
        'maxDepth'          => null,
        'minDepth'          => null,
        'onlyActiveBranch'  => false,
        'renderParents'     => true,
        'ulClass'           => 'vlist',
    );
    protected $_booleanValues = array('onlyActiveBranch', 'renderParents');

    public function menuRenderer($parentId = 0, $attribs = array())
    {
        if (!Zend_Registry::isRegistered('Zend_Navigation')) {
            // needed to register Navigation into Zend_Registry
            $menu = new Core_Menu($parentId);
        }
        $this->_setAttribs($attribs);

        // render partial
        if ($this->_issetPartial($attribs)) {
            return $this->view->navigation()->menu()->renderPartial(null, $attribs['partial']);
        }
        // render menu
        return $this->view->navigation()->menu()->renderMenu(null, $this->_getAttribs());
    }
}